// Achievement by G3X / GeXeH - Enjoy
// Version 1.0

// Achievement: Enter 100 Airboats.

local Value = achievements.GetValue( "Airboat Frenzy", "total", 0 )
local Status = false

local function Update()

	if (Value != 100) then
		// print("Check Started.\n")
		local ply = LocalPlayer()

		if (!ValidEntity( ply )) then return end
		
		if ( (ply:InVehicle()) && (ply:GetVehicle():GetClass() == "prop_vehicle_airboat") && (ply:GetVehicle():GetModel() == "models/airboat.mdl") ) then
			if !Status then
				Status = true
				// print("Player Inside Airboat.\n")
				Value = math.Clamp( Value + 1, 0, 100 )
				achievements.SetValue( "Airboat Frenzy", "total", Value )
				achievements.Update( "Airboat Frenzy", Value / 100, Value .. "/100" )
			end
		else
			Status = false
			// print("Player Outside Airboat.\n")
		end

		// print("Check Ended.\n")
	
	else
		timer.Destroy("Achievement.AirboatFrenzy")
	end

end

timer.Create("Achievement.AirboatFrenzy", 1, 0, Update)

achievements.Register( "Airboat Frenzy", "Enter 100 Airboats.", "achievements/airboatfrenzy", Value / 100, Value .. "/100" )